<template>
  <view class="home" :style="{ paddingTop: statusBarHeight }">
    <image
      src="../../assets/images/icons/head-bg.png"
      mode="scaleToFill"
      class="bg"
    />
    <view
      class="sss"
      :style="{ height: statusBarHeight, opacity: opacity }"
    ></view>
    <view class="search flex flex-a-c">
      <view @click="onSearch" class="input flex flex-a">
        <image
          src="../../assets/images/icons/search.png"
          mode="scaleToFill"
          class="search-icon"
        />
        <text class="text fs-28">请输入关键词</text>
      </view>
      <image
      @click="toMessage"
        class="bell"
        src="../../assets/images/icons/message.png"
        style="width: 48rpx;height: 48rpx;"
        mode="scaleToFill"
      />
    </view>
    <u-swiper indicator circular :list="list1"></u-swiper>
    <view @click="toGuide" class="for-new r-16 flex flex-bt">
      <view class="flex flex-a">
        <text class="fs-32 black bold">新人必看</text>
        <text class="des fs-24 dark-text">/ 说明</text>
      </view>
      <image src="../../assets/images/home/book.png"></image>
    </view>
    <view class="func flex">
      <view class="item r-16 flex flex-a flex-bt">
        <view class="left">
          <view class="top flex flex-a">
            <text class="fs-32 black bold">挂载教程</text>
            <image src="../../assets/images/icons/hot.png"></image>
          </view>
          <text class="des fs-24 dark-text">说明</text>
        </view>
        <image src="../../assets/images/home/video.png" class="right" />
      </view>
      <view class="item r-16 flex flex-a flex-bt">
        <view class="left">
          <view class="top flex flex-a">
            <text class="fs-32 black bold">每日推荐</text>
            <image src="../../assets/images/icons/hot.png"></image>
          </view>
          <text class="des fs-24 ellipsis dark-text">
            说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明说明
          </text>
        </view>
        <image src="../../assets/images/home/heart.png" class="right" />
      </view>
    </view>
    <List :onBottom="bottom" />
    <!-- <Tabbar /> -->
  </view>
</template>

<script>
import List from "./components/List.vue";
import { statusBarHeight } from "../../assets/utils/config";
import Tabbar from "../../compennts/tabbar/index.vue";
export default {
  components: { List, Tabbar },
  data() {
    return {
      statusBarHeight,
      opacity: 0,
      bottom: 0,
      list1: [
        "https://cdn.uviewui.com/uview/swiper/swiper1.png",
        "https://cdn.uviewui.com/uview/swiper/swiper2.png",
        "https://cdn.uviewui.com/uview/swiper/swiper3.png",
      ],
    };
  },

  onPageScroll({ scrollTop }) {
    let percent = scrollTop / 348;
    this.opacity = percent;
  },
  onReachBottom() {
    this.bottom++;
  },
  watch: {},
  methods: {
    toMessage() {
      uni.navigateTo({
        url: "/pages/mine/message/index",
      });
    },
    toGuide() {
      uni.navigateTo({
        url: "/pages/guide/index",
      });
    },
    onSearch() {
      console.log('search')
      uni.navigateTo({
        url: "/pages/index/search",
      })
    },
  },
};
</script>

<style lang="less" scoped>
@import url("../../assets/styles/common.less");
.sss {
  position: fixed;
  background: #ffffff;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 50;
  filter: blur(5);
}
.home {
  height: 100vh;
  box-sizing: border-box;
  background: linear-gradient(180deg, #93aafb 0%, #ffffff 496rpx);
  padding-left: 32rpx;
  padding-right: 32rpx;
  position: relative;
  z-index: 12;
  .bg{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    user-select: none;
    pointer-events: none;
  }
  .search {
    margin-bottom: 32rpx;
    // background: #ffffff;
    border-radius: 16rpx;
    height: 88rpx;
    .search-icon {
      width: 40rpx;
      height: 40rpx;
    }
    .input {
      height: 80rpx;
      background: #fff;
      border-radius: 16rpx;
      margin-right: 22rpx;
      padding:24rpx;
      flex:1;
      .text{
        color: rgba(31,35,41,0.4);
        padding-left: 4rpx;
      }
      .bell {
        font-size: 40rpx;
        color: #070b1c;
      }
    }
  }
  .for-new {
    margin-top: 32rpx;
    padding: 14rpx 32rpx 14rpx 32rpx;
    height: 120rpx;
    align-items: center;
    background: linear-gradient(92deg, #eaf6ff 0%, #f5fafe 100%);
    .des {
      margin-left: 16rpx;
    }
    image {
      width: 70rpx;
      height: 78rpx;
    }
  }
  .func {
    margin-top: 28rpx;
    .item {
      flex-shrink: 0 !important;
      flex: 1;
      background: linear-gradient(135deg, #fff5e3 0%, #fffcf6 100%);
      padding: 24rpx 32rpx;
      border-radius: 16rpx;
      height: 148rpx;
      &:nth-child(2) {
        margin-left: 22rpx;
        background: linear-gradient(135deg, #fff0f0 0%, #fff9f9 100%);
      }
      .left {
        .des {
          display: block;
          width: 168rpx;
          margin-top: 16rpx;
        }
        .top {
          image {
            width: 32rpx;
            height: 32rpx;
            margin-left: 12rpx;
          }
        }
      }
      .right {
        width: 72rpx;
        height: 72rpx;
      }
    }
  }
}
</style>
